From 29070efe2046543429dddf92a6b36c19f974c7f2 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Fri, 14 Dec 2007 10:25:00 +0000 Subject: [PATCH] xenoprof: flush remaining smples when sampling is stopped. Xenoprof notifies guest kernel via VIRQ_XENOPROF when sampled. But it does coarsly based on heuristic so that sometimes VIRQ_XENOPROF isn't delivered resulting in that oprofile daemon collects no sample. To avoid that situation, always send VIRQ_XENOPROF when sampling is stopped. Signed-off-by: Isaku Yamahata --- xen/common/xenoprof.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/xen/common/xenoprof.c b/xen/common/xenoprof.c index fee2a6556b..741c9f04d3 100644 --- a/xen/common/xenoprof.c +++ b/xen/common/xenoprof.c @@ -12,6 +12,7 @@ #ifndef COMPAT #include #include +#include #include #include #include @@ -747,14 +748,30 @@ int do_xenoprof_op(int op, XEN_GUEST_HANDLE(void) arg) break; case XENOPROF_stop: + { + struct domain *d; + struct vcpu *v; + int i; + if ( xenoprof_state != XENOPROF_PROFILING ) { ret = -EPERM; break; } xenoprof_arch_stop(); + + /* Flush remaining samples. */ + for ( i = 0; i < adomains; i++ ) + { + if ( !active_ready[i] ) + continue; + d = active_domains[i]; + for_each_vcpu(d, v) + send_guest_vcpu_virq(v, VIRQ_XENOPROF); + } xenoprof_state = XENOPROF_READY; break; + } case XENOPROF_disable_virq: { -- 2.30.2